﻿<?php
require_once('../../../config.php');
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->dirroot . '/local/myplugin/lib.php');
require_once($CFG->dirroot . "/local/myplugin/forms.php");
define('AJAX_SCRIPT', true);
global $DB;

//Lấy id của program cần chỉnh sửa 
$id = required_param('id', PARAM_TEXT);

/* Ket noi den file javascript - module.js */
$PAGE->requires->js_init_call('../M.local_myplugin');	
$mycss =  $CFG->wwwroot.'/local/myplugin/css/mycss.css';
 echo '<link rel="stylesheet" href="'.$mycss.'" type="text/css" media="screen" />';

 /* Viet doan code cua ban o day */
$mylib = new curriculum_management();

$mform = new form_modify_program(null, array('id'=>$id));


//bat su kien nhan nu cancel
if ($fromform = $mform->get_data()) 
{
	$option['id']= $_POST['id'];
	$option['program_name']= $fromform->txtten;
	$option['program_level']= $fromform->txtlevel;
	$option['program_type']= $fromform->txttype;
	$option['program_description']= $fromform->txtdesc;
	$mylib->update_program($option);
	//close colorbox
	echo "<script>parent.$.fn.colorbox.close(); </script>";
}


$mform->display();
/*------Ket thuc doan code cua ban-------*/

